<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>进销存固定报表</title>
<meta name="decorator" content="default"/>
<link href="${ctxStatic}/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet" />
<script src="${ctxStatic}/bootstrap-editable/js/bootstrap-editable.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('.qckc').editable(editableOption);
		$('.jzkc').editable({validate: function(value) {
		    // TODO 校验数字是否合法
		},params: function(params) {// 增加旧值参数
		    params.oldvalue = $(this).attr("data-oldvalue");
		    return params;
		},success: function(response, newValue) {// 成功后回调
		    $(this).attr("data-oldvalue",newValue);
			layer.msg("保存成功，新值："+newValue);
		}});
		$('.lqgj').editable({validate: function(value) {
		    // TODO 校验数字是否合法
		},params: function(params) {// 增加旧值参数
		    params.oldvalue = $(this).attr("data-oldvalue");
		    return params;
		},success: function(response, newValue) {// 成功后回调
		    $(this).attr("data-oldvalue",newValue);
			layer.msg("保存成功，新值："+newValue);
		}});
		$('.xjth').editable({validate: function(value) {
		    // TODO 校验数字是否合法
		},params: function(params) {// 增加旧值参数
		    params.oldvalue = $(this).attr("data-oldvalue");
		    return params;
		},success: function(response, newValue) {// 成功后回调
		    $(this).attr("data-oldvalue",newValue);
			layer.msg("保存成功，新值："+newValue);
		}});
		$('.xfsc').editable({validate: function(value) {
		    // TODO 校验数字是否合法
		},params: function(params) {// 增加旧值参数
		    params.oldvalue = $(this).attr("data-oldvalue");
		    return params;
		},success: function(response, newValue) {// 成功后回调
		    $(this).attr("data-oldvalue",newValue);
			layer.msg("保存成功，新值："+newValue);
		}});
		$('.thsj').editable({validate: function(value) {
		    // TODO 校验数字是否合法
		},params: function(params) {// 增加旧值参数
		    params.oldvalue = $(this).attr("data-oldvalue");
		    return params;
		},success: function(response, newValue) {// 成功后回调
		    $(this).attr("data-oldvalue",newValue);
			layer.msg("保存成功，新值："+newValue);
		}});
		$('.bfkc').editable({validate: function(value) {
		    // TODO 校验数字是否合法
		},params: function(params) {// 增加旧值参数
		    params.oldvalue = $(this).attr("data-oldvalue");
		    return params;
		},success: function(response, newValue) {// 成功后回调
		    $(this).attr("data-oldvalue",newValue);
			layer.msg("保存成功，新值："+newValue);
		}});
		$('.qmkc').editable({validate: function(value) {
		    // TODO 校验数字是否合法
		},params: function(params) {// 增加旧值参数
		    params.oldvalue = $(this).attr("data-oldvalue");
		    return params;
		},success: function(response, newValue) {// 成功后回调
		    $(this).attr("data-oldvalue",newValue);
			layer.msg("保存成功，新值："+newValue);
		}});
	});
	
	var editableOption = {validate: function(value) {
	    //return false;
		//return '价格不合法';
	},params: function(params) {// 增加旧值参数
		debugger;
	    params.oldvalue = $(this).attr("data-oldvalue");
	    return params;
	},success: function(response, newValue) {// 成功后回调
		debugger;
	    if(!response){
			layer.msg("保存失败，新值："+newValue);
	    	return false;
	    }
	    if ( !response.success){
			layer.msg("保存失败，新值："+newValue);
	    	return false;
	    }
	    $(this).attr("data-oldvalue",newValue);
		layer.msg("保存成功，新值："+newValue);
		return true;
	    //alert("newValue:"+newValue+",msg:"+response.msg);
		//if(!response.success) return response.msg;
	},error: function(response, newValue) {
	    debugger;
	    if(response.status === 500) {
	        return 'Service unavailable. Please try later.status:'+response.status;
	    } else {
	        return response.responseText;
	    }
	},url: function(params) {
	    debugger;
	    var d = new $.Deferred();
	    if(params.value === 'abc') {
	        return d.reject('error message'); //returning error via deferred object
	    }/*  else {
	    	someModel.asyncSaveMethod({
	    		success: function(){
	        		d.resolve();
	    		}
	        });  
	        return d.promise();
	    } */
	}};
	
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
	
	
</script>
<style type="text/css">
td .control-group {
    padding: 0px;
}
</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/report/bsReportOutin/">进销存固定报表列表</a></li>
		<shiro:hasPermission name="report:bsReportOutin:edit"><li><a href="${ctx}/report/bsReportOutin/form">进销存固定报表添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="bsReportOutin" action="${ctx}/report/bsReportOutin/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input id="reportId" name="reportId" type="hidden" value="${bsReportOutin.reportId}"/>
		<ul class="ul-form">
			<li><label>storecode：</label>
				<form:input path="storecode" htmlEscape="false" maxlength="32" class="input-medium"/>
			</li>
			<li><label>vaccine_id：</label>
				<form:input path="vaccineId" htmlEscape="false" maxlength="20" class="input-medium"/>
			</li>
			<li><label>batchno：</label>
				<form:input path="batchno" htmlEscape="false" maxlength="32" class="input-medium"/>
			</li>
			<li><label>create_date：</label>
				<input name="createDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${bsReportOutin.createDate}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			</li>
			<li class="clearfix"></li>
		</ul>
		<ul class="ul-form">
			<li class="btns"><button id="btnSubmit" class="btn btn-primary" />查询</button></li>
			<li class="btns"><button id="btnCancel" class="btn" type="button" onclick="history.go(-1)">返回</button></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<!-- <th>storecode</th> -->
				<th>疫苗名称</th>
				<th>剂量</th>
				<th>剂型</th>
				<th>规格</th>
				<th>容器</th>
				<th>厂家</th>
				<th>有效期</th>
				<th>批号</th>
				<th>售价</th>
				<th>成本价</th>
				<th>期初库存</th>
				<th>建账库存</th>
				<th>领取购进</th>
				<!-- <th>领取下发</th> -->
				<th>下级退回</th>
				<!-- <th>下级拒收</th> -->
				<th>下发售出</th>
				<th>退回上级</th>
				<th>报废库存</th>
				<th>期末库存</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="bsReportOutin">
			<tr>
				<td>
					${bsReportOutin.vaccineName}
				</td>
				<td>
					${bsReportOutin.dose}
				</td>
				<td>
					${bsReportOutin.doseType}
				</td>
				<td>
					${bsReportOutin.spec}
				</td>
				<td>
					${bsReportOutin.containerType}
				</td>
				<td>
					${bsReportOutin.companyName}
				</td>
				<td>
					<fmt:formatDate value="${bsReportOutin.outBoundDate}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
					${bsReportOutin.batchno}
				</td>
				<td>
					${bsReportOutin.sellprice}
				</td>
				<td>
					${bsReportOutin.orignprice}
				</td>
				<td>
					<a href="#" class = 'qckc' data-disabled = "false" data-mode = "inline" data-inputclass="input-mini" data-type="text"
						<%-- data-url="${ctx}/report/bsReportOutin/updateOutin" --%>
						data-pk="${bsReportOutin.id}" data-name="qckc" data-oldvalue="${bsReportOutin.qckc}" >${bsReportOutin.qckc}</a>
				</td>
				<td>
					<a href="#" class = 'jzkc' data-disabled = "false" data-mode = "inline" data-inputclass="input-mini" data-type="text"
						data-url="${ctx}/report/bsReportOutin/updateOutin"
						data-pk="${bsReportOutin.id}" data-name="jzkc" data-oldvalue="${bsReportOutin.jzkc}" >${bsReportOutin.jzkc}</a>
				</td>
				<td>
					<a href="#" class = 'lqgj' data-disabled = "false" data-mode = "inline" data-inputclass="input-mini" data-type="text"
						data-url="${ctx}/report/bsReportOutin/updateOutin"
						data-pk="${bsReportOutin.id}" data-name="lqgj" data-oldvalue="${bsReportOutin.lqgj}" >${bsReportOutin.lqgj}</a>
				</td>
				<%-- <td>
					${bsReportOutin.lqxf}
				</td> --%>
				<td>
					<a href="#" class = 'xjth' data-disabled = "false" data-mode = "inline" data-inputclass="input-mini" data-type="text"
						data-url="${ctx}/report/bsReportOutin/updateOutin"
						data-pk="${bsReportOutin.id}" data-name="xjth" data-oldvalue="${bsReportOutin.xjth}" >${bsReportOutin.xjth}</a>
				</td>
				<%-- <td>
					${bsReportOutin.xjjs}
				</td> --%>
				<td>
					<a href="#" class = 'xfsc' data-disabled = "false" data-mode = "inline" data-inputclass="input-mini" data-type="text"
						data-url="${ctx}/report/bsReportOutin/updateOutin"
						data-pk="${bsReportOutin.id}" data-name="xfsc" data-oldvalue="${bsReportOutin.xfsc}" >${bsReportOutin.xfsc}</a>
				</td>
				<td>
					<a href="#" class = 'thsj' data-disabled = "false" data-mode = "inline" data-inputclass="input-mini" data-type="text"
						data-url="${ctx}/report/bsReportOutin/updateOutin"
						data-pk="${bsReportOutin.id}" data-name="thsj" data-oldvalue="${bsReportOutin.thsj}" >${bsReportOutin.thsj}</a>
				</td>
				<td>
					<a href="#" class = 'bfkc' data-disabled = "false" data-mode = "inline" data-inputclass="input-mini" data-type="text"
						data-url="${ctx}/report/bsReportOutin/updateOutin"
						data-pk="${bsReportOutin.id}" data-name="bfkc" data-oldvalue="${bsReportOutin.bfkc}" >${bsReportOutin.bfkc}</a>
				</td>
				<td>
					<a href="#" class = 'qmkc' data-disabled = "false" data-mode = "inline" data-inputclass="input-mini" data-type="text"
						data-url="${ctx}/report/bsReportOutin/updateOutin"
						data-pk="${bsReportOutin.id}" data-name="qmkc" data-oldvalue="${bsReportOutin.qmkc}" >${bsReportOutin.qmkc}</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>